package com.itheima.alipay.config;


import java.io.FileWriter;
import java.io.IOException;

/**
 * @author Xiao
 * @version 1.0
 * @description
 * @date 2021/11/16
 */
public class AlipayConfigInfo {
    // ↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000118651632";//例：2016082600317257

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCducVt8UythR5qUSlDiysCl+ilTfdLTUwqUwadZ1hpkscdHOJfEZu1bLAsoTBYIjCh88DlgwiHQe/J2b6iDhQkzpWbMxdDgHtSEw7W/zn9AHM6JJzV+H0xvpXCi2v9P7HPVkBrr5b0CQSWGzwWeACfDRQ0USzfejVTNSYZaLTNm4ab+uawMba/+e8d2sdBw5ajUOdx0AiKoQ+//P21pq942KJCDBvfGDBe5/l0QLTUx7OBAhKpNmW4sY7iCzpBlYxtmD6v1EsI7toOTRdJmeuhlyQjzeSXtLPx6aWiYKN4kkwWaZ/Gg0l95ce+T380HlwJpo1dHnszb3IT9YAOFYJ/AgMBAAECggEAezxZXCu7Y6CtQRilCxdDxcT3i6E9ZWLB7hftBTNoSyTZ2o9k+C8D4F9Jz7Up1tLv+LpBr5IQKc6FEsvFPU2Ow6t+DUOAG8fZkyk84ROONXYSkg1lVXHQL/vfe6AAAmGwBnY342vQoGAjaz1gV5XvtlY7wRzj2MDdxWOznwrGqhZtjIJpVO/oJFXBqbhXQ+IGY7kRutDDOpBh8Ef6vj0fh9uktkatQvIFzNrUNetWCsXESG8DsVPL1XQNB6FwsclsmDLnbDy5r8Vt4Szn95Bqh17D0Evpae7pWWmKakQABPhxNTjET+AcSpEbNCOjFlLEjaDOex1YNoZkJAEHZerTQQKBgQDa/5AqM6HGRT23OQ/L4hFoqlwlGp6x0jKq1XkypZxh+BP53dZK7Caq3no+HYnD1bpQwS535ncAdXw7ZvO0jqKg7KgURzpGj07Kopsv5Z9n/RP4OgQsYOmB/Y8Qtl1jSl5kJJ3/Z1/ACPMC9FIMYWSycMnAd6kfCL3rdRTl4QR9kQKBgQC4X/RH7Gm37MMq40sFoalt4uGiVb2NVl/p08IFUyIPpTVDAPR0yByuxb9Tr+gLu40YcnBs7zR53SadizKY81xbDW8nFVIWFy5io03zKrQP4JQxkTg/gksS4GRIDUlmq85EXYhtOXN8mt3sG7I9v+NfizehEmTgFPuk0zmx3lg3DwKBgFXlUT1MPRKQS/GWfvyf8eYUk8m11DK42EirLDtSO7EtZWBmw0tlrpDsbBP67/MQ3GAaNUiv61MRwaVm7wWNwHnP+OjjOxc71FKkTqwNq2VVHUUKNGLXrB7hPgD3FlAAdl9fAV2QxTyEBhTNkXTrqlxW4rsL9BiJDDzTElxL0sARAoGAdnkx/wVq6US6JFTpYDUBKhsf4bA2nRtjhl0Lz2AcAvGlx+hVLLVpuORYjO37rY5Wm97tXxJWJfh1V8aaPK4kKl33jqWkmY1LwRYugJJwIcOtdixaeHTAyOBnj+T5xX+gi02O3KCOFQNulsk1P3iOIlbS6C1ppJPXH5KbADBffwECgYBXF9RQyCjdWGnvYlhXCNl5ggWWhcYekVZHn84fMbf7Xo5pasMMLTFZuj8SfM+4p/Ek6r+LOTK7qkoQrmYoNeu5eeBeB/42s3rKCDWV5knZ1jeeUES+wkxYTX1vZIXrTdgKHMb99fNzy7eWXkYXpGjxIlUW10A29pfSCE74cSXiOw==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm
    // 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnbnFbfFMrYUealEpQ4srApfopU33S01MKlMGnWdYaZLHHRziXxGbtWywLKEwWCIwofPA5YMIh0Hvydm+og4UJM6VmzMXQ4B7UhMO1v85/QBzOiSc1fh9Mb6Vwotr/T+xz1ZAa6+W9AkElhs8FngAnw0UNFEs33o1UzUmGWi0zZuGm/rmsDG2v/nvHdrHQcOWo1DncdAIiqEPv/z9taaveNiiQgwb3xgwXuf5dEC01MezgQISqTZluLGO4gs6QZWMbZg+r9RLCO7aDk0XSZnroZckI83kl7Sz8emlomCjeJJMFmmfxoNJfeXHvk9/NB5cCaaNXR57M29yE/WADhWCfwIDAQAB";
    // 服务器异步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    /**
     * 返回的时候此页面不会返回到用户页面，只会执行你写到控制器里的地址
     */
    public static String notify_url = "http://localhost:8888/notify_url";
    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    /**
     * 此页面是同步返回用户页面，也就是用户支付后看到的页面，上面的notify_url是异步返回商家操作，谢谢
     * 要是看不懂就找度娘，或者多读几遍，或者去看支付宝第三方接口API，不看API直接拿去就用，遇坑不怪别人
     */
    public static String return_url = "http://localhost:8888/order/return_url";
    // 签名方式
    public static String sign_type = "RSA2";
    // 字符编码格式
    public static String charset = "UTF-8";
    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
    // 日志地址
    public static String log_path = "D:\\develop\\IdeaProjects\\testProjects\\alipay-demo\\log";
    // ↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "\\alipay_log_"
                    + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
